#include <iostream>
#include <list>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	list<int> l;
	vector<int> revIndex(300000, -2);
	vector<int> index;
	int lastNum = 2;

	revIndex[1] = 0;
	revIndex[2] = 1;
	index.push_back(1);
	index.push_back(2);

	for (int i = 3; i < 500000; ++i)
		l.push_back(i);

	for (int i = 2; i < 100000; ++i) {
		for (list<int>::iterator it = l.begin(); it != l.end(); ++it) {
			if (__gcd(*it, lastNum) != 1) {
				index.push_back(*it);
				revIndex[*it] = i;
				lastNum = *it;
				l.erase(it);
				break;
			}
		}
	}

	cout << "Done";
	cout << endl;
}
